package com.itheima.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.Collectors;

public class Demo07 {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>(List.of("坤坤","坤坤", "签签", "滔滔", "鹿鹿", "小绵羊", "小绵羊"));

       //想办法 把 最终的结果收集起来
        //System.out.println(list);
        ArrayList<String> newList = new ArrayList<>();
        list.stream().skip(3).forEach(s->newList.add(s));
        //Collector=Collectors.toList()
        //Collector<String, ?, List<String>> shoujiqi =Collectors.toList() ;
        List<String> list1 = list.stream().skip(3).collect(Collectors.toList());
        System.out.println(list1);
        Set<String> set = list.stream().collect(Collectors.toSet());
        System.out.println(set);

    }
}
